<?php
// 设置时区
date_default_timezone_set("PRC");
include 'MMysql.php';
// require_once 'errorhandle.php';
  

$mysql = new MMysql();
if(!empty($_GET['from_uid'])){
	$mysql->where(['from_uid'=>$_GET['from_uid']]);
}
$res = $mysql->select('user3');//$mysql->_doQuery("select * from user where openid ='".$data['openid']."'");
foreach($res as &$user){
	if($user['type'] == 2){
		$share_user = $mysql->where(['uid'=>$user['id']])->limit(1)->select('share_log');
		$user['share'] = !empty($share_user[0]) ? $share_user[0] : [];
	}
}
$clickCount = $mysql->field([
				"sum(qjnk)","sum(qwys)","sum(xmzl)",
				"sum(huxingjianshang_a)","sum(huxingjianshang_a2)",
				"sum(huxingjianshang_b)","sum(huxingjianshang_b2)"
				,"sum(huxingjianshang_c)","sum(huxingjianshang_c2)"
				,"sum(huxingjianshang_e)","sum(huxingjianshang_e2)"
				,"sum(huxing3d_a)","sum(huxing3d_b)","sum(huxing3d_c)"
				,"sum(huxing3d_d)","sum(huxing3d_e)","sum(huxing3d_f)"
				,"sum(yangbanjian_ass)","sum(yangbanjian_bss)"
				])->limit(1)->select('user3');
$userCount = $mysql->field(["count(*)"])->limit(1)->select('user3');//用户总数量
$clickTotalCount = 0;//总点击数
foreach($clickCount[0] as $count){
	$clickTotalCount += $count;
}

?>

<!DOCTYPE html>

<html style="z-index:999999">
<head>
<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">	
	<meta http-equiv="x-ua-compatible" content="IE=edge">
	<meta http-equiv="Pragma" content="no-cache"> 
	<meta http-equiv="Cache-Control" content="no-cache">
	<meta http-equiv="Expires" content="0">
	
<title>蓉璟臺</title>
	
	<style>
		

	</style>
</head>
<body>
	<style>
		
</style>
	
<table style="border: 4px solid #ccc;width:100%;text-align: center;">
	<tr style="border: 4px solid #ccc;">
	
		<td width="10%" style="width:150px;">姓名<br/><br/><span style="float:right;border:1px solid #ccc;height:20px;width:70px;float:left;margin-bottom:0px;">总计</span></td>
		<td width="10%" style="width:150px;">手机号<br/><br/><span style="float:right;border:1px solid #ccc;height:20px;width:120px;float:left;margin-bottom:0px;"></span></td>
		<td width="10%" style="width:150px;">名称<br/><br/><span style="float:right;border:1px solid #ccc;height:20px;width:100px;float:left;margin-bottom:0px;"></span></td>
		<td width="10% " style="width:40px;">头像<br/><br/><span style="float:right;border:1px solid #ccc;height:20px;width:40px;float:left;"><?=$userCount[0]['count(*)']?></span></td>
		<td width="10%" style="width:40px;">性别<br/><br/><span style="float:right;border:1px solid #ccc;height:20px;width:40px;float:left;"></span></td>
		<td width="10%" style="width:150px;">地址<br/><br/><span style="float:right;border:1px solid #ccc;height:20px;width:70px;float:left;"></span></td>
		<td style="width:150px;" width="10%">时间<br/><br/><span style="float:right;border:1px solid #ccc;height:20px;width:120px;float:left;"></span></td>
		
		<td width="5%" style="width:150px;">全景鸟瞰<br/><br/><span style="border:1px solid #ccc; width:70px;float:left;"><?=$clickCount[0]['sum(qjnk)']?></span></td>
		<td width="5%" style="width:150px;">区位优势<br/><br/><span style="border:1px solid #ccc; width:70px;float:left;"><?=$clickCount[0]['sum(qwys)']?></span></td>
		<td width="5%" style="width:150px;">项目总览<br/><br/><span style="border:1px solid #ccc; width:70px;float:left;"><?=$clickCount[0]['sum(xmzl)']?></span></td>
		<!-- <td width="5%">户型鉴赏</td> -->
		<td  style="width:150px;">户型鉴赏a <br/><br/><span style="border:1px solid #ccc; width:80px;float:left;"><?=$clickCount[0]['sum(huxingjianshang_a)']?></span></td>
		<td style="width:150px;">户型鉴赏a2<br/><br/><span style="border:1px solid #ccc; width:100px;float:left;"><?=$clickCount[0]['sum(huxingjianshang_a2)']?></span></td>
		<td style="width:150px;">户型鉴赏b<br/><br/><span style="border:1px solid #ccc; width:80px;float:left;"><?=$clickCount[0]['sum(huxingjianshang_b)']?></span></td>
		<td style="width:150px;">户型鉴赏b2<br/><br/><span style="border:1px solid #ccc; width:100px;float:left;"><?=$clickCount[0]['sum(huxingjianshang_b2)']?></span></td>
		<td style="width:150px;">户型鉴赏c<br/><br/><span style="border:1px solid #ccc; width:80px;float:left;"><?=$clickCount[0]['sum(huxingjianshang_c)']?></span></td>
		<td style="width:150px;">户型鉴赏c2<br/><br/><span style="border:1px solid #ccc; width:80px;float:left;"><?=$clickCount[0]['sum(huxingjianshang_c2)']?></span></td>
		<td style="width:150px;">户型鉴赏e<br/><br/><span style="border:1px solid #ccc; width:80px;float:left;"><?=$clickCount[0]['sum(huxingjianshang_e)']?></span></td>
		<td style="width:150px;">户型鉴赏e2<br/><br/><span style="border:1px solid #ccc; width:100px;float:left;"><?=$clickCount[0]['sum(huxingjianshang_e2)']?></span></td>
		<!-- <td >精装漫游</td> -->
		<td style="width:150px;">3D户型a1<br/><br/><span style="border:1px solid #ccc; width:70px;float:left;"><?=$clickCount[0]['sum(huxing3d_a)']?></span></td>
		<td style="width:150px;">3D户型b2<br/><br/><span style="border:1px solid #ccc; width:90px;float:left;"><?=$clickCount[0]['sum(huxing3d_b)']?></span></td>
		<td style="width:150px;">3D户型c1<br/><br/><span style="border:1px solid #ccc; width:70px;float:left;"><?=$clickCount[0]['sum(huxing3d_c)']?></span></td>
		<!-- <td >3D户型</td> -->
		<td style="width:150px;">3D户型c2<br/><br/><span style="border:1px solid #ccc; width:70px;float:left;"><?=$clickCount[0]['sum(huxing3d_d)']?></span></td>
		 <td style="width:150px;">漫游体验<br/><br/><span style="border:1px solid #ccc; width:70px;float:left;"><?=$clickCount[0]['sum(huxing3d_e)']?></span></td>
		
		<!-- <td >3D户型g</td>-->
	</tr>
	<?php foreach($res as $v){?>
	<tr style="border: 4px solid #ccc;" onClick='queryUser(<?=json_encode($v)?>)'>
		
		<td style="border: 1px solid #ccc;"><?php echo $v['realname']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['mobile']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['name']?></td>
		<td style="border: 1px solid #ccc;"><img width="30px" src="<?php echo $v['headimgurl']?>"></td>
		<td style="border: 1px solid #ccc;"><?php if($v['sex']==1){echo '男';}else{echo '女';}?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['country'].$v['province'].$v['city']?></td>
		<td style="border: 1px solid #ccc;"><?php echo date("Y-m-d H:i:s",$v['create_time']);?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['qjnk']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['qwys']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['xmzl']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxingjianshang_a']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxingjianshang_a2']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxingjianshang_b']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxingjianshang_b2']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxingjianshang_c']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxingjianshang_c2']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxingjianshang_e']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxingjianshang_e2']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxing3d_a']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxing3d_b']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxing3d_c']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxing3d_d']?></td>
		<td style="border: 1px solid #ccc;"><?php echo $v['huxing3d_e']?></td>
		<!-- <td style="border: 1px solid #ccc;"></td> -->
	</tr>
	
	<?php }?>
</table>

</body>
<script src="JS/jquery-3.3.1.min.js"></script>
<script>
	function queryUser(user){
		console.log(user);
		if(user.type == 2){
			console.log(window.location);
			var url = window.location.origin+window.location.pathname;
			url += "?from_uid="+user.id;
			window.location.href = url;
		}
	}
</script>
</html>


 
